import 'package:flutter_base_plugin/flutter_base_plugin.dart';
import 'package:flutter_base_plugin_example/models/goods_model.dart';
import 'package:flutter_base_plugin_example/models/home_product_model.dart';
import 'package:flutter_base_plugin_example/net/http_urls.dart';

import '../model/model.dart';

class HomeViewModel extends BaseObjViewModel<HomeProductModel> {
  List<NavBar> navBarList = [
    NavBar(
      name: "商品分类",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/02d9e202109101106364468.png",
      path: "",
    ),
    NavBar(
      name: "领优惠卷",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/4a21a202109101106368349.png",
      path: "path",
    ),
    NavBar(
      name: "行业资讯",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/49d20202109101106377392.png",
      path: "path",
    ),
    NavBar(
      name: "我的收藏",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/9d74b20210910110637104.png",
      path: "path",
    ),
    NavBar(
      name: "地址管理",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/1c95120210910110636424.png",
      path: "path",
    ),
    NavBar(
      name: "秒杀活动",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/23332202109101106361126.png",
      path: "path",
    ),
    NavBar(
      name: "砍价活动",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/1c95120210910110636424.png",
      path: "path",
    ),
    NavBar(
      name: "拼团活动",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/34930202109101106363502.png",
      path: "path",
    ),
    NavBar(
      name: "订单管理",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/a4c37202109101106353478.png",
      path: "path",
    ),
    NavBar(
      name: "积分商城",
      image:
          "https://qiniu.crmeb.net/attach/2021/09/34f81202109101106357549.png",
      path: "path",
    ),
  ];
  List<TitleItem> titleList = [
    TitleItem(title: "首发新品", subTitle: "最新出炉"),
    TitleItem(title: "精品推荐", subTitle: "猜你喜欢"),
    TitleItem(title: "热门榜单", subTitle: "好评如云"),
    TitleItem(title: "促销单品", subTitle: "多买多销"),
  ];

  List<String> banner = [
    "http:\/\/crmeb.shop.joekai.top\/uploads\/attach\/2022\/06\/20220626\/baca2999facf2f8e6b5a95c9dfbc6fb0.jpeg",
    "http:\/\/crmeb.shop.joekai.top\/uploads\/attach\/2022\/06\/20220626\/89e520c1b0b8b2fcb4abc4c7c93a3091.jpeg",
    "http:\/\/crmeb.shop.joekai.top\/uploads\/attach\/2022\/06\/20220626\/f2db664da8fe5841d2e9be9306600281.jpeg",
    "http:\/\/crmeb.shop.joekai.top\/uploads\/attach\/2022\/06\/20220626\/5857d280a6237f0ed2d395cfdabcc162.jpeg",
    "http:\/\/crmeb.shop.joekai.top\/uploads\/attach\/2022\/06\/20220626\/7ad4d31face9e1a59378f51d4dcbdfa0.jpeg",
    "http:\/\/crmeb.shop.joekai.top\/uploads\/attach\/2022\/06\/20220626\/ea6bf11b5ea22e895a74c7dbea27ac99.jpeg",
    "http:\/\/crmeb.shop.joekai.top\/uploads\/attach\/2022\/06\/20220626\/2fc82c33654af1a73ff6045f0bd2e865.jpeg",
    "http:\/\/crmeb.shop.joekai.top\/uploads\/attach\/2022\/06\/20220626\/4ee5f73243f421d2a352c67ac735413d.jpeg"
  ];

  @override
  String getTag() {
    // TODO: implement getTag
    return "HomeViewModel";
  }

  int selectIndex = 0;

  setSelectIndex(index) {
    selectIndex = index;
    onLoading();
    notifyListeners();
  }

  @override
  Map<String, dynamic> getRequestParams() {
    // TODO: implement getRequestParams
    return {
      "selectType": selectIndex,
    };
  }

  @override
  String getUrl() {
    // TODO: implement getUrl
    return HttpUrls.homeProductList + "/${selectIndex + 1}";
  }
}
